<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .content{
      display:flex;
      flex-wrap:wrap;
    }
    .btn{
      display: inline-block;
      padding:6px 12px;
      background-color: #ccc;
      border:1px solid transparent;
      border-radius: 4px;
      color:#fff;
      text-decoration: none;
      font-size: 14px;
      line-height: 1.42857143;
      cursor: pointer;
    }
    .btn:hover{
      background-color: #b3b3b3;
      border-color: #b3b3b3
    }
    .primary{
      background-color: #337ab7;
      border-color: #2e6da4;
    }
    .success{
      background-color: #5cb85c;
      border-color: #4cae4c;
    }
  </style>
</head>
<body>

  <template id="image-box-template">
    <style>
      .image-box{
        width: 200px;
        height: 200px;
        border:1px solid #ccc;
        margin:10px;
        padding:10px;
        box-sizing: border-box;
      }
      .image-box .img{
        width: 100%;
        height: 100%;
      }
      .image-box .title{
        font-size: 20px;
        font-weight: bold;
        margin:10px 0;
      }
      .image-box .price{
        font-size: 16px;
        color:#666;
      }
    </style>

    <div class="image-box">
      <img class="img" src="" alt="">
      <div class="title"></div>
      <div class="price"></div>
      <div class="action">
        <slot name="btn-action"></slot>
      </div>
    </div>
  </template>

  <div class="content">
    <image-box
      url="./images/奥利奥蛋糕.jpeg"
      title="奥利奥蛋糕"
      price="20"
    >
      <button slot="btn-action" class="btn primary">加入购物车</button>
    </image-box>
    <image-box
      url="./images/奥利奥奶茶.jpeg"
      title="奥利奥奶茶"
      price="22"
    >
      <button slot="btn-action" class="btn success">直接购买</button>
    </image-box>
    <image-box
      url="./images/百香凤梨.jpeg"
      title="百香凤梨"
      price="16"
    >
      <button slot="btn-action" class="btn primary">加入购物车</button>
    </image-box>
    
  </div>
</body>
<script src="./index.js"></script>
</html>
